'''
__tags__ = "tree, build, parent, children"

class TreeBuilder(ni.Node):
    parent = ni.Attribute()
    children = ni.List(itemtype=ni.Attribute())
    tree = ni.Tree(item_type=ni.Attribute(), depends=(parent, children,))
    
    def prepare_update(self):
        self.tree.clear()
    
    def compute_tree(self):
        item = self.tree.get_item(self.parent)
        if item is None:
            item = self.tree.add_child(self.parent)
        
        for child in self.children:
            item.add_child(child)
            
        return self.tree
'''